<template>

  <ul>
    <router-link tag="li" class="animate__animated animate__bounceIn" :to="{path:'/goods',query:{goodsId:item.goodsId}}" li v-for="(item,index) in searchList" :key="index">
      <div class="img">
        <img :src="item.coverImgUrl" alt="">
      </div>
      <div class="searchBody">
        <div class="intro">
            <p>
              {{item.name}}
            </p>
            <p>
              ￥{{item.price}}
            </p>
        </div>
        <p>
          {{item.intro}}
        </p>
      </div>

    </router-link>
    <van-pagination v-model="currentPage" :page-count="Math.floor(total/10)" mode="simple" />
  </ul>
</template>

<script>
export default {
name: "SearchList",
  data(){
    return{
      currentPage: 1,
      showFlag:true,
    }
  },
  props:{
    searchList:Array,
    total:[Number,String]
  },
  created() {
    console.log(this.searchList)
  },
  watch:{
    currentPage(){
      this.$emit('changePage',this.currentPage)
    }
  }
}
</script>

<style scoped lang="less">
ul{
  padding: 15px;
  >li{
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    width: 90%;
    padding: 20px 15px;
    border-radius: 15px;
    box-shadow: 2px 2px 5px #ddd;
    border: 1px solid #ddd;
    >.img{
      width: 60px;
      height: 60px;
      >img{
        width: 100%;
        height: 100%;
      }
    }
    >.searchBody{
      width: 60%;
      padding: 0 10px;
      flex-grow: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      >.intro{
        width: 100%;
        display: flex;
        justify-content: space-between;
          >p:first-child{
            width: 75%;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }
          >p:nth-child(2){
            color: red;
            font-size: 18px;
          }

      }
      >p{
        overflow : hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 14px;
        color: #aaa;
      }
    }

  }
}
</style>